
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>6.1 配置方式 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="css/default.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="rule-pattern.html" />
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    1. xProxy 是什么？
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="good.html">
            
                <a href="good.html">
            
                    
                    1.1 xProxy 的优势
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="charles-diff.html">
            
                <a href="charles-diff.html">
            
                    
                    1.2 与 Charles 对比
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="INSTALL.html">
            
                <a href="INSTALL.html">
            
                    
                    2. xProxy 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    3. 面板说明
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="panel-main.html">
            
                <a href="panel-main.html">
            
                    
                    3.1 首页面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="panel-network.html">
            
                <a href="panel-network.html">
            
                    
                    3.2 Network 网络面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="panel-rule.html">
            
                <a href="panel-rule.html">
            
                    
                    3.3 Rules 规则面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="panel-value.html">
            
                <a href="panel-value.html">
            
                    
                    3.4 Values 值面板
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="start.html">
            
                <a href="start.html">
            
                    
                    4. 快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="frequent.html">
            
                <a href="frequent.html">
            
                    
                    4.1 常用功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="fit-recore.html">
            
                <a href="fit-recore.html">
            
                    
                    4.2 适配 Recore
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="fit-go.html">
            
                <a href="fit-go.html">
            
                    
                    4.3 适配乐高
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    5. 迁移
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="ihost.html">
            
                <a href="ihost.html">
            
                    
                    5.1 iHost 迁移
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="xswitch.html">
            
                <a href="xswitch.html">
            
                    
                    5.2 xSwitch 迁移
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="charles-m.html">
            
                <a href="charles-m.html">
            
                    
                    5.3 Charles 迁移
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    6. 规则
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.6.1" data-path="rule-model.html">
            
                <a href="rule-model.html">
            
                    
                    6.1 配置方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="rule-pattern.html">
            
                <a href="rule-pattern.html">
            
                    
                    6.2 匹配模式 pattern
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="rule-opv.html">
            
                <a href="rule-opv.html">
            
                    
                    6.3 操作值 opValue
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="rule-opp.html">
            
                <a href="rule-opp.html">
            
                    
                    6.4 匹配原则 opProtocol
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="mobile.html">
            
                <a href="mobile.html">
            
                    
                    7. 移动端接入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="qa.html">
            
                <a href="qa.html">
            
                    
                    8. 常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="th.html">
            
                <a href="th.html">
            
                    
                    致谢
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    反馈
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >6.1 配置方式</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x914D;&#x7F6E;&#x65B9;&#x5F0F;">&#x914D;&#x7F6E;&#x65B9;&#x5F0F;</h1>
<p>xProxy &#x7684;&#x6240;&#x6709;&#x64CD;&#x4F5C;&#x90FD;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x914D;&#x7F6E;&#x5B9E;&#x73B0;&#xFF0C;&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#x6269;&#x5C55;&#x4E8E;&#x7CFB;&#x7EDF; hosts &#x914D;&#x7F6E;&#x65B9;&#x5F0F;(<code>ip domain&#x6216;&#x7EC4;&#x5408;&#x65B9;&#x5F0F;ip domain1 domain2 domainN</code>)&#xFF0C;&#x5177;&#x6709;&#x66F4;&#x4E30;&#x5BCC;&#x7684;&#x5339;&#x914D;&#x6A21;&#x5F0F;&#x53CA;&#x66F4;&#x7075;&#x6D3B;&#x7684;&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#x3002;</p>
<p>&#x89C4;&#x5219;&#x7684;&#x5339;&#x914D;&#x987A;&#x5E8F;&#x662F;&#x4ECE;&#x5DE6;&#x5230;&#x53F3;&#xFF0C;&#x8FD9;&#x4E0E;&#x4F20;&#x7EDF; hosts &#x4ECE;&#x53F3;&#x5230;&#x5DE6;&#x7684;&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#x4E0D;&#x540C;&#xFF0C;&#x4F46;&#x4E3A;&#x4E86;&#x517C;&#x5BB9;&#x4F20;&#x7EDF; hosts &#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#xFF0C;&#x9664;&#x4E86;pattern &#x548C; operatorURI &#x90FD;&#x53EF;&#x4EE5;&#x4E3A;&#x8BF7;&#x6C42; url &#x5916;(&#x8FD9;&#x79CD;&#x60C5;&#x51B5; xProxy &#x65E0;&#x6CD5;&#x81EA;&#x52A8;&#x533A;&#x5206; pattern &#x548C; operatorURI&#xFF0C;&#x53EA;&#x80FD;&#x6309;&#x7EA6;&#x5B9A;&#x7684;&#x987A;&#x5E8F;&#x5339;&#x914D;)&#xFF0C;&#x5176;&#x5B83;&#x60C5;&#x51B5; xProxy &#x90FD;&#x652F;&#x6301;&#x914D;&#x7F6E;&#x4E24;&#x8FB9;&#x7684;&#x4F4D;&#x7F6E;&#x5BF9;&#x8C03;&#xFF0C;&#x5373;&#xFF1A;<code>pattern operatorURI</code> &#x548C; <code>operatorURI pattern</code> &#x7B49;&#x4EF7;&#x3002;</p>
<blockquote>
<p>&#x5199;&#x89C4;&#x5219;&#x65F6;&#x8DDF;&#x4F20;&#x7EDF; hosts &#x914D;&#x7F6E;&#x4E00;&#x6837;&#x4E5F;&#x91C7;&#x7528; <code>#</code> &#x4E3A;&#x6CE8;&#x91CA;&#x7B26;&#x53F7;</p>
</blockquote>
<h4 id="&#x89C4;&#x5219;&#x6709;&#x4EE5;&#x4E0B;&#x4E09;&#x79CD;&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#xFF1A;">&#x89C4;&#x5219;&#x6709;&#x4EE5;&#x4E0B;&#x4E09;&#x79CD;&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#xFF1A;</h4>
<h5 id="&#x9ED8;&#x8BA4;&#x65B9;&#x5F0F;">&#x9ED8;&#x8BA4;&#x65B9;&#x5F0F;</h5>
<p>&#x9ED8;&#x8BA4;&#x662F;&#x5C06;&#x5339;&#x914D;&#x6A21;&#x5F0F;&#x5199;&#x5728;&#x5DE6;&#x8FB9;&#xFF0C;&#x64CD;&#x4F5C;uri&#x5199;&#x5728;&#x53F3;&#x8FB9;</p>
<pre><code>pattern operatorURI
</code></pre><p>&#x89C4;&#x5219;&#x5C06;&#x8BF7;&#x6C42;url&#x4E0E;pattern&#x5339;&#x914D;&#xFF0C;&#x5982;&#x679C;&#x5339;&#x914D;&#x5230;&#x5C31;&#x6267;&#x884C;operatorURI&#x5BF9;&#x5E94;&#x7684;&#x64CD;&#x4F5C;&#x3002;</p>
<h5 id="&#x4F20;&#x7EDF;&#x65B9;&#x5F0F;">&#x4F20;&#x7EDF;&#x65B9;&#x5F0F;</h5>
<p>&#x4F20;&#x7EDF;&#x65B9;&#x5F0F;&#x6307;&#x7684;&#x662F;&#x4F20;&#x7EDF;&#x7684;hosts&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#xFF0C;&#x64CD;&#x4F5C;URI&#x5199;&#x5728;&#x5DE6;&#x8FB9;</p>
<pre><code>operatorURI pattern
</code></pre><p>&#x5982;&#x679C;pattern&#x4E3A;&#x8DEF;&#x5F84;&#x6216;&#x57DF;&#x540D;&#xFF0C;&#x4E14;operatorURI&#x4E3A;&#x57DF;&#x540D;&#x6216;&#x8DEF;&#x5F84;</p>
<pre><code>www.test.com www.example.com/index.html
http://www.test.com www.example.com/index.html
</code></pre><p>&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#x65E0;&#x6CD5;&#x533A;&#x5206;pattern&#x548C;operatorURI&#xFF0C;&#x5E95;&#x5C42;&#x5E93;&#x4E0D;&#x652F;&#x6301;&#x8FD9;&#x79CD;&#x4F20;&#x7EDF;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x53EA;&#x652F;&#x6301;&#x9ED8;&#x8BA4;&#x65B9;&#x5F0F;&#x3002;</p>
<h5 id="&#x7EC4;&#x5408;&#x65B9;&#x5F0F;">&#x7EC4;&#x5408;&#x65B9;&#x5F0F;</h5>
<p>&#x4F20;&#x7EDF;hosts&#x7684;&#x914D;&#x7F6E;&#x5BF9;&#x591A;&#x4E2A;&#x57DF;&#x540D;&#x5BF9;&#x4E8E;&#x540C;&#x4E00;&#x4E2A;ip&#x53EF;&#x4EE5;&#x91C7;&#x7528;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#xFF1A;</p>
<pre><code>127.0.0.1  www.test1.com www.test2.com www.testN.com
</code></pre><p>xProxy &#x5B8C;&#x5168;&#x517C;&#x5BB9;&#x4F20;&#x7EDF;hosts&#x914D;&#x7F6E;&#x65B9;&#x5F0F;&#xFF0C;&#x4E14;&#x652F;&#x6301;&#x66F4;&#x591A;&#x7684;&#x7EC4;&#x5408;&#x65B9;&#x5F0F;&#xFF1A;</p>
<pre><code class="lang-sh"><span class="hljs-comment"># &#x4F20;&#x7EDF;&#x7EC4;&#x5408;&#x65B9;&#x5F0F;</span>
pattern operatorURI1 operatorURI2 operatorURIN

<span class="hljs-comment"># &#x5982;&#x679C;pattern&#x90E8;&#x5206;&#x4E3A;&#x8DEF;&#x5F84;&#x6216;&#x57DF;&#x540D;&#xFF0C;&#x4E14;operatorURI&#x4E3A;&#x57DF;&#x540D;&#x6216;&#x8DEF;&#x5F84;</span>
<span class="hljs-comment"># &#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#x4E5F;&#x652F;&#x6301;&#x4E00;&#x4E2A;&#x64CD;&#x4F5C;&#x5BF9;&#x5E94;&#x591A;&#x4E2A;pattern</span>
operatorURI pattern1 pattern2 patternN
</code></pre>
<p>&#x914D;&#x7F6E;&#x6362;&#x884C;&#xFF1A;</p>
<pre><code class="lang-sh">www.test.com file://(<span class="hljs-built_in">test</span>) filter://*/cgi-bin
<span class="hljs-comment"># &#x7B49;&#x4EF7;&#x4E8E;</span>
line`
www.test.com file://(<span class="hljs-built_in">test</span>)
filter://*/cgi-bin
`
<span class="hljs-comment"># &#x6216;</span>
line`
www.test.com
file://(<span class="hljs-built_in">test</span>)
filter://*/cgi-bin
</code></pre>
<p>&#x5176;&#x4E2D;&#xFF0C;pattern&#x8BF7;&#x53C2;&#x8003;&#xFF1A;&#x5339;&#x914D;&#x6A21;&#x5F0F; pattern&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="rule-pattern.html" class="navigation navigation-next navigation-unique" aria-label="Next page: 6.2 匹配模式 pattern">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"6.1 配置方式","level":"1.6.1","depth":2,"next":{"title":"6.2 匹配模式 pattern","level":"1.6.2","depth":2,"path":"rule-pattern.md","ref":"rule-pattern.md","articles":[]},"previous":{"title":"6. 规则","level":"1.6","depth":1,"ref":"","articles":[{"title":"6.1 配置方式","level":"1.6.1","depth":2,"path":"rule-model.md","ref":"rule-model.md","articles":[]},{"title":"6.2 匹配模式 pattern","level":"1.6.2","depth":2,"path":"rule-pattern.md","ref":"rule-pattern.md","articles":[]},{"title":"6.3 操作值 opValue","level":"1.6.3","depth":2,"path":"rule-opv.md","ref":"rule-opv.md","articles":[]},{"title":"6.4 匹配原则 opProtocol","level":"1.6.4","depth":2,"path":"rule-opp.md","ref":"rule-opp.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"css/default.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"language":"zh-hans","gitbook":"*"},"file":{"path":"rule-model.md","mtime":"2019-11-05T10:46:22.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-17T11:59:46.789Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

